package com.imooc.validator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 自定义注解
 * Created by zghgchao 2018/4/15 10:48
 *  @Target({ElementType.METHOD,ElementType.FIELD}):注解作用于方法或类上面
 *  @Retention(RetentionPolicy.RUNTIME)：运行时注解
 *  @Constraint(validatedBy = ):该注解的执行逻辑的类在哪里
 */
@Target({ElementType.METHOD,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = MyConstraintValidator.class)
public @interface MyConstraint {
    String message();

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
